-- CALC_SUMMON_MAGIC

-- 计算召唤兽当前魔力
-- @param summon    召唤兽
return function(summon)
    local magic = summon:query("magic") or 0;
    local classId = summon.class_id;
    local prop = {};

    -- TODO: 玩家对召唤兽属性加成%
    local addon = FormulaM.invoke("SUMMON_ATTRIB_ADDITION", summon, magic, "magic");

    -- 攻击+N
    prop = PropM.combine(summon, "attrib2", "magic");
    magic = PropM.apply(prop, magic);

    -- 根据楼层攻击+
    prop = PropM.combine(summon, "attrib_by_floor", "magic");
    if prop[3] > 0 then
        magic = PropM.trigger(summon, prop[1], prop[2], magic);
    end

    -- 所有召唤物能力加
    prop = PropM.combine(ME.user, "summon_attrib", "magic");
    magic = PropM.apply(prop, magic);

    -- 攻击+N
    -- magic = magic + summon.dbase:queryTemp("attack_addon", 0);

    -- TODO: 玩家的亡灵骨铠有加成
    if SummonM.query(classId, "dbase")["equipment_add"] == 1 then
        prop = PropM.combine(ME.user, "aid_attrib2", "magic");
        magic = PropM.apply(prop, magic);
    end

    return magic + addon;
end
